package com.etsoft.ETEnglish.iCloud;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class MyCommandLineRunner implements CommandLineRunner {
    @Value("${server.port}")
    String port;
    @Value("${app.ip}")
    String ip;

    @Override
    public void run(String... args) throws Exception {
        String hostUrl = "http://" + ip + ":" + port;
        System.out.println("Visit Url:\n\t" + hostUrl);
        try {
            Runtime.getRuntime().exec("open " + hostUrl);
        } catch (Exception ignored) {}
    }
}
